import requests
from bs4 import BeautifulSoup

login_url = r"https://github.com/login"
repo_url = r"https://github.com/Lingchenpei?tab=repositories"

data = {
    "login": "2472566186@qq.com",
    "password": "921219*.as"
}
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
}
with requests.Session() as s:
    login_page = s.get(login_url, headers=headers)
    soup = BeautifulSoup(login_page.text, "html.parser")
    token = soup.find("input", {"name": "authenticity_token"})['value']
    data.update({"Referer": r"https://github.com/",
                 "authenticity_token": token})
    response = s.post(login_url, data=data, headers=headers)

    repo_response = s.get(repo_url, headers=headers)
    repo_soup = BeautifulSoup(repo_response.text, "html.parser")
    repo_list = repo_soup.find_all('a', {'itemprop': 'name codeRepository'})
    for repo in repo_list:
        print(repo.text.strip())
